﻿{include file="public/header"}
<title>问题反馈列表</title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> 问题反馈
    <span class="c-gray en">&gt;</span> 问题反馈列表
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <form method="get">
        <div class="text-c"> 反馈时间：
            <input type="text" name="start_time" id="countTimestart" onfocus="selecttime(1)" size="17" class="date input-text" readonly style="width:100px" value="<?php echo isset($data['start_time'])?$data['start_time']:''?>">
            -
            <input type="text" name="end_time" id="countTimeend" onfocus="selecttime(2)" size="17" class="date input-text" readonly style="width:100px" value="<?php echo isset($data['end_time'])?$data['end_time']:''?>">
            <span class="select-box inline">
                <select name="type" class="select">
                    <option value="1" <?php  if(isset($data['type']) && $data['type']==1){echo 'selected';}?> >用户</option>
                    <option value="2" <?php  if(isset($data['type']) && $data['type']==2){echo 'selected';}?> >机构</option>
                </select>
		    </span>
            <input type="text" name="username" placeholder=" 用户/机构" style="width:250px" class="input-text" value="<?php echo isset($data['username'])?$data['username']:''?>">
            <input type="text" name="mobile" placeholder=" 电话" style="width:250px" class="input-text" value="<?php echo isset($data['mobile'])?$data['mobile']:''?>">
            <button class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
        </div>
    </form>
    <div class="mt-20">
        <table class="table table-border table-bordered table-bg table-hover table-sort">
            <thead>
            <tr class="text-c">
                <th width="80">序号</th>
                <th width="80">反馈者</th>
                <th width="100">用户/机构</th>
                <th width="100">电话</th>
                <th width="100">反馈内容</th>
                <th width="100">反馈图片</th>
                <th width="100">反馈时间</th>
                <th width="100">操作</th>
            </tr>
            </thead>
            <tbody>
            {volist name='list' id='vo'}
            <tr class="text-c">
                <td>{$vo.question_id}</td>
                <td>
                    {if condition="$vo.type == 1"} 用户
                    {elseif condition="$vo.type == 2"/}机构
                    {else /} 未知
                    {/if}
                </td>
                {if condition="$vo.type == 1"}
                <td>{$vo.username}</td>
                <td>{$vo.mobile}</td>
                {elseif condition="$vo.type == 2"/}
                <td>{$vo.vender_name}</td>
                <td>{$vo.vender_mobile}</td>
                {else /}
                <td></td>
                <td></td>
                {/if}
                <td>{$vo.content}</td>
                <td>
                {volist name='vo.img' id='val'}
                <img src="{$val}" class="layer-img" style="max-width: 100px;max-height: 50px">&nbsp;
                {/volist}
                </td>
                <td>{:date('Y-m-d H:i:s',$vo['created_time'])}</td>
                <td class="td-manage">
                    <a style="text-decoration:none" class="ml-5 del" data-id="{$vo.question_id}" href="javascript:;" title="删除"><span class="label label-danger">删除</span></a>

                </td>
            </tr>
            {/volist}
            </tbody>
        </table>
        <div class="pages" style="float: right">{$list->render()}</div>

    </div>
</div>

{include file="public/footer"}
<script type="text/javascript">
    function selecttime(flag) {
        if (flag == 1) {
            var endTime = $("#countTimeend").val();
            if (endTime != "") {
                WdatePicker({dateFmt: 'yyyy-MM-dd', maxDate: endTime})
            } else {
                WdatePicker({dateFmt: 'yyyy-MM-dd'})
            }
        } else {
            var startTime = $("#countTimestart").val();
            if (startTime != "") {
                WdatePicker({dateFmt: 'yyyy-MM-dd', minDate: startTime})
            } else {
                WdatePicker({dateFmt: 'yyyy-MM-dd'})
            }
        }
    }

    /**
     * 删除
     */
    $('.del').click(function () {
        var id=$(this).attr('data-id');
        var obj={};
        obj.question_id=id;
        var src="{:Url('index/question/del')}";
        layer.confirm('确认要删除吗？', function (index) {
            $.ajax({
                type: 'POST',
                url: src,
                dataType: 'json',
                data: obj,
                success: function (data) {
                    var res=JSON.parse(data);
                    if(res.code==200){
                        layer.msg(res.msg, {icon: 1, time: 2000}, function () {
                            setTimeout("window.location.reload()", 1);
                        });
                    }else{
                        layer.msg(res.msg,{icon: 5,time:1000});
                    }

                },
                error: function (data) {
                    console.log(data.msg);
                },
            });
        });
    });
</script>
</body>
</html>